package com.rst.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="t_attendance")
public class Attendance {
	
	public static final int PRESENT = 1;
	public static final int ABSENT = 0;
	
	public Attendance(){
		
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="f_id")
	private Long id;	
	
	@Column(name="f_student_id")
	private Long studentId;	

	@Column(name="f_attendance_status")
	private int status;	

	@Column(name="f_reason")
	private String reason;	
			
	@Temporal(TemporalType.DATE)
	@Column(name="f_date")
	private Date date;	

	@Column(name="f_section_id")
	private Long sectionId;	
	
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="f_section_id", nullable=false, insertable=false, updatable=false)
	private Section section ;

	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="f_student_id", nullable=false, insertable=false, updatable=false)
	private Student student;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getStudentId() {
		return studentId;
	}

	public void setStudentId(Long studentId) {
		this.studentId = studentId;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}


	public Long getSectionId() {
		return sectionId;
	}

	public void setSectionId(Long sectionId) {
		this.sectionId = sectionId;
	}

	public Section getSection() {
		return section;
	}

	public void setSection(Section section) {
		this.section = section;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
	
	
	

}
